package com.example.booklist.dao;

import com.example.booklist.model.BookInfo;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * ClassName: BookDao
 * Package: IntelliJ IDEA
 * Description:
 *
 * @Author 谷京京
 * @Create 2023/10/30 18:35
 * @Version 1.0
 */
@Repository
public class BookDao {
    public List<BookInfo> mockData() {
        List<BookInfo> bookInfos = new ArrayList<>(15);
        for(int i = 0; i < 15; i++) {
            BookInfo bookInfo = new BookInfo();
            bookInfo.setBookName(i + "书");
            bookInfo.setStatus(i % 5 == 0 ? 2 : 1);
            bookInfo.setAuthor("作者i");
            bookInfo.setCount(new Random().nextInt(200));
            bookInfo.setId(i);
            bookInfo.setPrice(new BigDecimal(new Random().nextInt(100)));
            bookInfo.setPublish("" + i);
            bookInfos.add(bookInfo);
        }
        return bookInfos;
    }
}
